﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace ClassLibrary01
{
    public class Conexao
    {
        private static Conexao instancia;

        private Conexao()
        {
        }

        public static Conexao getInstacia()
        {
            if (instancia == null)
            {
                instancia = new Conexao();
            }
            return instancia;
        }

        public SqlConnection Conectar()
        {
            //String stringConexao = "Server=localhost;Database=intermed;User Id=sa;Password=" ;

            String stringConexao = @"Server=WIN7-VM\SQLEXPRESS;Database=intermed;Trusted_Connection=true";

           
           SqlConnection conn = new SqlConnection(stringConexao);
            conn.Open();
            return conn;
        }

        public void Desconectar(SqlConnection conn)
        {
            conn.Close();
        }
    }
}
